<?php
abstract class Myself_Controller_Action extends Zend_Controller_Action{
    private $_dbConfig;
    protected $_thisDb;

    public function init() {
        parent::init();
        $configPath = ROOT . '/zendweb/configs/application.ini';
        $options = new Zend_Config_Ini($configPath, 'dbconfig');
        $options = $options->toArray();
        $this->_dbConfig = $options['resources']['db'];
        $yiiblogConfig = $this->_dbConfig['yiiblog'];
        $this->_thisDb = Zend_Db::factory($yiiblogConfig['adapter'], $yiiblogConfig['params']);
        //Zend_Db_Table::setDefaultAdapter( $db );
        Zend_Db_Table::setDefaultAdapter($this->_thisDb);
    }

    protected function getOtherDbAction($db) {
        if (!empty($db) && array_key_exists($db, $this->_dbConfig)) {
            try {
                $thisDbConfig = $this->_dbConfig[$db];
                $this->_thisDb = Zend_Db::factory($thisDbConfig['adapter'], $thisDbConfig['params']);
                 Zend_Db_Table::setDefaultAdapter($this->_thisDb);
            } catch (Exception $e) {
                
            }
        } else {
            
        }
    }
}